import logging
from appium.webdriver.common.mobileby import MobileBy
from Hogwarts.Homeworks.hw0704.page_objects.base import Base


class PageMemberProfileEdit(Base):

    _BTN_BOX_CONFIRM = (MobileBy.XPATH, "//*[@text='确定']")
    _BTN_BOX_CANCEL = (MobileBy.XPATH, "//*[@text='取消']")
    _TOAST_MSG = (MobileBy.XPATH, "//*[@class='android.widget.Toast']")

    def tap_remove_member(self):
        from Hogwarts.Homeworks.hw0704.page_objects.page_contact import PageContact

        logging.info("STEP：点击删除成员按钮")
        self.find_with_scroll("删除成员").click()

        # 添加屏幕截图
        self.do_screenshot('删除成员确认弹窗')

        logging.info("STEP：在弹窗中点击“确定”按钮")
        self.find_and_click(*self._BTN_BOX_CONFIRM)

        return PageContact(self.driver)
